//
//  SuperPlayerView+Private.h
//  TXLiteAVDemo
//
//  Created by annidyfeng on 2018/7/9.
//  Copyright © 2018年 Tencent. All rights reserved.
//

#ifndef CTSuperPlayerView_Private_h
#define CTSuperPlayerView_Private_h

#import "CTSuperPlayer.h"
#import "CTSuperPlayerControlViewDelegate.h"
#import "CTNetWatcher.h"
#import <MediaPlayer/MediaPlayer.h>
#import <Masonry.h>
#import <AFNetworking.h>
#import "SPSubStreamInfo.h"
#import <AVFoundation/AVFoundation.h>
@class TXVodPlayer, TXLivePlayer;

// 枚举值，包含水平移动方向和垂直移动方向
typedef NS_ENUM (NSInteger, CTPanDirection) {
    CTPanDirectionHorizontalMoved, // 横向移动
    CTPanDirectionVerticalMoved    // 纵向移动
};

/// 按钮事件
typedef NS_ENUM (NSInteger, CTPlayerButtonAction) {
    CTPlayerActionNone,
    CTPlayerActionRetry,
    CTPlayerActionSwitch,
    CTPlayerActionIgnore,
    CTPlayerActionContinueReplay,
};

@interface CTSuperPlayerView () <UIGestureRecognizerDelegate,
                                 CTSuperPlayerControlViewDelegate,
                                 AVAssetResourceLoaderDelegate>

/** 用来保存快进的总时长 */
@property (nonatomic, assign) CGFloat sumTime;
@property (nonatomic, assign) CGFloat startVeloctyPoint;

/** 定义一个实例变量，保存枚举值 */
@property (nonatomic, assign) CTPanDirection panDirection;
/** 是否在调节音量 */
@property (nonatomic, assign) BOOL isChangingVolume;
/** 是否被用户暂停 */
@property (nonatomic, assign) BOOL isPausedByUser;
/** 播放完了*/
@property (nonatomic, assign) BOOL playDidEnd;
/** 进入后台*/
@property (nonatomic, assign) BOOL didEnterBackground;
/** 单击 */
@property (nonatomic, strong) UITapGestureRecognizer *singleTap;
/** 双击 */
@property (nonatomic, strong) UITapGestureRecognizer *doubleTap;
/// 快进快退View
@property (nonatomic, strong) CTSuperPlayerFastView *fastView;

@property (nonatomic, setter = setDragging:) BOOL isDragging;
/// 中间的提示按钮
@property (nonatomic, strong) UIButton *middleBlackBtn;
@property CTPlayerButtonAction middleBlackBtnAction;

/// 系统菊花
@property (nonatomic, strong) MMMaterialDesignSpinner *spinner;

@property (nonatomic, strong) UIButton *lockTipsBtn;

@property (nonatomic, strong) CTSuperPlayerModel *playerModel;

@property (class, readonly) UISlider *volumeViewSlider;

@property (nonatomic, strong) MPVolumeView *volumeView;

// add for txvodplayer
@property (nonatomic, assign) BOOL isLoaded;

@property (nonatomic, assign) BOOL isShiftPlayback;

@property (nonatomic, assign) CGFloat maxLiveProgressTime;    // 直播最大进度/总时间
@property (nonatomic, assign) CGFloat liveProgressTime;       // 直播播放器回调过来的时间
@property (nonatomic, assign) CGFloat liveProgressBase;       // 直播播放器超出时移的最大时间

#define MAX_SHIFT_TIME (2 * 60 * 60)

/** 是否是直播流 */
@property BOOL isLive;

/** 腾讯点播播放器 */
@property (nonatomic, strong) TXVodPlayer *vodPlayer;
/** 腾讯直播播放器 */
@property (nonatomic, strong) TXLivePlayer *livePlayer;

@property NSDate *reportTime;

@property CTNetWatcher *netWatcher;

@property (nonatomic) CGFloat videoRatio;

/// 由协议解析出分辨率定义表
@property (nonatomic, strong) NSArray<SPSubStreamInfo *> *resolutions;

@end

#pragma mark - —————————————— CTSuperPlayerModel ————————————

@class CTAdaptiveStream;
@interface CTSuperPlayerModel ()

@property NSMutableArray<CTAdaptiveStream *> *streams;

@end

#endif /* CTSuperPlayerView_Private_h */
